<template>
	<view class="element">
		
		<view @click="taobaoele(0)" class="element_list">
			<view class="meituan_list-title">
				外卖
			</view>
			<view class="element_list_top">
				<image src="../../../static/home/chaoshi.jpg" mode="widthFix"></image>
			</view>
			<view class="element_list_bottom">
				<view class="element_list_bottom_left">
					<image src="../../../static/home/eleme1.png"></image>
				</view>
				<view class="element_list_bottom_right">
					<image src="../../../static/home/eleme2.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
		
		<view @click="taobaoele(1)" class="element_list">
			<view class="meituan_list-title">
				生鲜蔬果
			</view>
			<view class="element_list_top">
				<image src="../../../static/home/waimai.jpg" mode="widthFix"></image>
			</view>
			<view class="element_list_bottom">
				<view class="element_list_bottom_left">
					<image src="../../../static/home/eleme3.png"></image>
				</view>
				<view class="element_list_bottom_right">
					<image src="../../../static/home/eleme4.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
		<!-- 外卖 ↓ -->
		<!-- <image @click="taobaoele(0)" src="../../../static/home/chaoshi.jpg" mode="widthFix"></image> -->
		<!-- 超市 ↓ -->
		<!-- <image @click="taobaoele(1)" src="../../../static/home/waimai.jpg" mode="widthFix"></image> -->
	</view>
</template>

<script>
	import {
		taobaoele
	} from '@/api/home'
	export default {
		data() {
			return {
				src: '',
			}
		},
		onNavigationBarButtonTap(e) {
			console.log(1111, e)
			// this.$scope.$getAppWebview().children()[0].close()
			// uni.navigateBack({
			// 	delta: 10
			// })
			// uni.navigateTo({
			// 	url:'./meituan'
			// })
			uni.switchTab({
				url: '../index'
			})
		},
		methods: {
			taobaoele(num) {
				taobaoele(num).then(res => {
					if (res.success == 1) {
						uni.navigateTo({
							url: '/pages/index/elementView/elementView?src=' + encodeURIComponent(res.data
								.click_url)
						})
					} else {
						uni.showToast({
							title: res.message,
							duration: 2000,
							icon: 'none'
						});
					}
				})
			},
			// toview(src) {
			// 	let ss = encodeURIComponent(src)
			// 	uni.navigateTo({
			// 		url: './meituanview?src=' + ss
			// 	})
			// }
		}
	}
</script>


<style lang="scss" scoped>
	.element {
		.meituan_list-title {
			margin-bottom: 30upx;
			font-size: 40upx;
			font-weight: 700;
		}
		padding: 10upx;

		.element_list {
			margin-bottom: 30upx;

			.element_list_top {
				image {
					width: 100%;
					font-size: 0;
				}
			}

			.element_list_bottom {
				display: flex;

				.element_list_bottom_left {
					width: calc(415upx + 10upx);
					padding-right: 10upx;
					font-size: 0;

					image {
						width: 100%;
						font-size: 0;
						height: 100%;
					}
				}

				.element_list_bottom_right {
					// width: calc(100% - 415upx - 10upx);
					flex: 1;
					font-size: 0;

					image {
						font-size: 0;
						width: 100%;
					}
				}
			}
		}
	}
</style>
<style>
	page {
		background-color: #F4F4F4;
	}
</style>
